package jface;

import jface.util.MyWizard;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class JFaceWizardExample extends ApplicationWindow {

	public JFaceWizardExample() {
		super(null);
		this.addToolBar(SWT.FLAT | SWT.WRAP);
	}
	
	protected ToolBarManager createToolBarManager(int style) {
		ToolBarManager toolBarManager = new ToolBarManager(style);
		toolBarManager.add(new Action(){@Override
			public String getText() {
				return "Do complex action";
			}
		
			public void run() {
				WizardDialog wd = new WizardDialog(new Shell(), new MyWizard());
				wd.open();
			}
		
		});
		return toolBarManager;
	}

	public static void main(String[] args) {
		JFaceWizardExample fe = new JFaceWizardExample();
		fe.setBlockOnOpen(true);
		fe.open();
		Display.getCurrent().dispose();
	}
	
	
}